Event.Form.OpenForm(Form[, RecordID, FormParameters, LayoutID])
Event.Form.OpenForm() opens an editing form via scripting. This allows a user to open a specific form via scripting rather than using the default Deacom form. User can now create versions of forms unique to specific requirements and use user-defined buttons or data on the current form along with OpenForm() to open specific forms in Deacom.
Notes:
-
Deacom uses the form MainMain throughout the system and to get a specific instance of the MainMain form, you will need to use the WITH keyword along with the instance in quotes. "mainmain WITH \"dmfcur\"".
-
The OpenForm method has been modified to avoid overload ambiguity and to support calling with FormName rather than FormID.
Example: If you have different workflows and fields to fill in for sales orders, quotes, or returns, you can now create form layouts specific to each workflow and use Event.Form.OpenForm() to open the specific form layout desired.
Applies To
Properties and Methods
None
Available
The .OpenForm(Form[, RecordID, FormParameters, LayoutID]) method is available in:
- 17.00.016
- 17.01.005
- All newer builds
Note: The .OpenForm(Form[, RecordID, FormParameters, LayoutID]) method and all sub-classes, properties, and methods are only available in Form Layout scripts.
Type
Method
Syntax
Event.Form.OpenForm(Form[, RecordID, FormParameters, LayoutID]);
Parameters
|
Parameter |
Required |
Description |
|---|---|---|
|
Form |
Yes |
A valid Form Name that the user wants to open. These are the Deacom FormNames i.e.: NewOrd1, ContAdd, MatAdd, or NewJob1 mainmain form requires the keyword WITH along with the instance in quotes: lcForm = "mainmain WITH \"dmfcur\""; |
|
RecordID |
No |
If given, will open a specific record in the form layout. If set to 0 or not used, then will open a new record in the form. |
|
FormParameters |
No |
This should always be null. This is for future use. Currently, only parameter available is RecordID, which is programmatically fed to the FormParameters from the RecordID parameter in base Deacom. |
|
LayoutID |
No |
A specific user layout ID dmuserlayout.ul_id. Note: If you provide a ul_id that is for a user group or a specific user, and the person activating the OpenForm() is not part of the user group or the specific user, that user will see the prompt 'Form Not Yet Implemented'. |
|
Filter |
No |
A key value pair for the Filter properties. |
|
Display |
No |
A key value pair for the Display properties. |
|
CustomFilters |
No |
A structure for the Custom Filters Properties:
|
Example
//--Make sure that the following variable is a ul_id for a NewOrd1 form layout
//--Make sure that the following variable is a ul_id for a NewOrd1 form layout
var lnLayout = 11;
var lnID = Event.Form.MainGrid.SelectedRow.GetInteger('ID');
if(Event.Form.YesNo(`About to Open NewOrd1 for ${lnID} \r\n'Yes' for default form, 'No' for a specific layout of this form.`))
{
Event.Form.OpenForm('NewOrd1', lnID); //--Opens the default version of the NewOrd1 form for that specific user for the record ID
}
else
{
Event.Form.OpenForm('NewOrd1', 0, null, lnLayout); //--If you are allowed to use this specific version of the NewOrd1 form, it will open for you with a blank record.
//--Otherwise you will get a 'Form Not Yet Implemented' prompt